/*
 * @Descripttion:
 * @version:
 * @Date: 2021-04-20 11:06:21
 * @LastEditors: huzhushan@126.com
 * @LastEditTime: 2021-04-21 09:36:55
 * @Author: huzhushan@126.com
 * @HomePage: https://huzhushan.gitee.io/vue3-element-admin
 * @Github: https://github.com/huzhushan/vue3-element-admin
 * @Donate: https://huzhushan.gitee.io/vue3-element-admin/donate/
 */
import request from '@/utils/request'

const base_api='/admin/system/sysRole'

// 权限角色列表查询
export const GetSysRoleList = (current,limit,queryDto) => {
  return request({
    url: `${base_api}/findByPage/${current}/${limit}`,
    method: 'post',
    data: queryDto ,
  })
}

export const saveSysRole = (sysRole) => {
  return request({
    url: `${base_api}/saveSysRole`,
    method: 'post',
    data: sysRole ,
  })
}

export const updateSysRole = (sysRole) => {
  return request({
    url: `${base_api}/updateRole`,
    method: 'put',
    data: sysRole ,
  })
}

export const deleteSysRole = (roleId) => {
  return request({
    url: `${base_api}/deleteById/${roleId}`,
    method: 'delete'
   
  })
}

export const findSysRole = (userId) => {
  return request({
    url: `${base_api}/findAll/${userId}`,
    method: 'get'
   
  })
}


// 查询指定角色所对应的菜单id
export const GetSysRoleMenuIds = (roleId) => {
  return request({
      url: "/admin/system/sysRoleMenu/findSysRoleMenuByRoleId/"+ roleId,
      method: 'get'
  })
}

// 根据角色分配菜单请求方法
export const DoAssignMenuIdToSysRole = (assignMenuDto) => {
  return request({
      url: "/admin/system/sysRoleMenu/doAssign",
      method: 'post',
      data: assignMenuDto
  })
}




